package com.xbzl.cly_demo.vo;

import com.xbzl.cly_demo.entity.VehicleAbnormalRecords;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

public class VehicleVO implements Serializable {
    private String vehicleVin;
    private String deviceName;
    private String plateNo;
    private List<VehicleAbnormalRecords> vehicleAbnormalRecords;

    public VehicleVO() {}

    public VehicleVO(String vehicleVin, String deviceName, String plateNo, List<VehicleAbnormalRecords> vehicleAbnormalRecords) {
        this.vehicleVin = vehicleVin;
        this.deviceName = deviceName;
        this.plateNo = plateNo;
        this.vehicleAbnormalRecords = vehicleAbnormalRecords;
    }

    public String getVehicleVin() {
        return vehicleVin;
    }

    public void setVehicleVin(String vehicleVin) {
        this.vehicleVin = vehicleVin;
    }

    public String getDeviceName() {
        return deviceName;
    }

    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

    public String getPlateNo() {
        return plateNo;
    }

    public void setPlateNo(String plateNo) {
        this.plateNo = plateNo;
    }

    public List<VehicleAbnormalRecords> getVehicleAbnormalRecords() {
        return vehicleAbnormalRecords;
    }

    public void setVehicleAbnormalRecords(List<VehicleAbnormalRecords> vehicleAbnormalRecords) {
        this.vehicleAbnormalRecords = vehicleAbnormalRecords;
    }

    @Override
    public String toString() {
        return "VehicleVO{" +
                "vehicleVin='" + vehicleVin + '\'' +
                ", deviceName='" + deviceName + '\'' +
                ", plateNo='" + plateNo + '\'' +
                ", vehicleAbnormalRecords=" + vehicleAbnormalRecords +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof VehicleVO)) return false;
        VehicleVO that = (VehicleVO) o;
        return Objects.equals(vehicleVin, that.vehicleVin) &&
                Objects.equals(deviceName, that.deviceName) &&
                Objects.equals(plateNo, that.plateNo) &&
                Objects.equals(vehicleAbnormalRecords, that.vehicleAbnormalRecords);
    }

    @Override
    public int hashCode() {
        return Objects.hash(vehicleVin, deviceName, plateNo, vehicleAbnormalRecords);
    }

    // ===== Builder 实现 =====
    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private String vehicleVin;
        private String deviceName;
        private String plateNo;
        private List<VehicleAbnormalRecords> vehicleAbnormalRecords;

        public Builder vehicleVin(String vehicleVin) {
            this.vehicleVin = vehicleVin;
            return this;
        }

        public Builder deviceName(String deviceName) {
            this.deviceName = deviceName;
            return this;
        }

        public Builder plateNo(String plateNo) {
            this.plateNo = plateNo;
            return this;
        }

        public Builder vehicleAbnormalRecords(List<VehicleAbnormalRecords> vehicleAbnormalRecords) {
            this.vehicleAbnormalRecords = vehicleAbnormalRecords;
            return this;
        }

        public VehicleVO build() {
            return new VehicleVO(vehicleVin, deviceName, plateNo, vehicleAbnormalRecords);
        }
    }
}
